package com.jxc.jxc01.grc.web;

import com.jxc.jxc01.grc.entity.Manifest;

import com.jxc.jxc01.grc.service.IManifestService;
import com.jxc.jxc01.grc.service.impl.IManifestServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@WebServlet(value = "/addmanifest")
public class AddManifestServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request,
                           HttpServletResponse response)
            throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");

        int numbering = Integer.parseInt(request.getParameter("numbering"));
        String warehouse = request.getParameter("warehouse");
        String commodity = request.getParameter("commodity");
        String quantity = request.getParameter("quantity");
        String specification = request.getParameter("specification");
        double price = Double.valueOf(request.getParameter("price"));
        double total = Double.valueOf(request.getParameter("total"));
        String depositor = request.getParameter("depositor");
        String whethe = request.getParameter("whethe");
        String quality = request.getParameter("quality");

        String inbound_time = request.getParameter("Inbound_time");
        String creation_time = request.getParameter("creation_time");
        String remark = request.getParameter("remark");

        Manifest manifest = new Manifest();
        manifest.setNumbering(numbering);
        manifest.setWarehouse(warehouse);
        manifest.setCommodity(commodity);
        manifest.setQuantity(quantity);
        manifest.setSpecification(specification);
        manifest.setPrice(price);
        manifest.setTotal(total);
        manifest.setDepositor(depositor);
        manifest.setWhethe(whethe);
        manifest.setQuality(quality);
        manifest.setInbound_time(inbound_time);
        manifest.setCreation_time(creation_time);
        manifest.setRemark(remark);
        IManifestService manifestService = new IManifestServiceImpl();
        boolean b = manifestService.addOneOfInBill(manifest);
        if (b) {
            System.out.println("添加成功");
        } else {
            System.out.println("添加失败");
        }
    }
}
